def 希尔排序(arr):
    n=len(arr)
    gap=n//2
    while gap>0:
        for i in range(gap,n):
            tmp=arr[i]
            j=i-gap
            while j>=0 and arr[j]>tmp:
                arr[j+gap]=arr[j]
                j-=gap
            arr[j+gap]=tmp
        gap//=2
    return arr
print(希尔排序([9,8,7,6,5,4,3,2,1]))